package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;

public class GetFieldTest implements Test {

	public void run() throws Throwable {
		Asserts.assertEquals(SubClassMock1.class.getField("switcher").getName(), "switcher");
		Asserts.assertEquals(SubClassMock1.class.getField("switcher").getModifiers(), Modifier.PUBLIC | Modifier.STATIC);
		Asserts.assertEquals(SubClassMock1.class.getField("switcher").getType(), boolean.class);
				
		Asserts.assertEquals(SubClassMock1.class.getField("flag").getName(), "flag");
		Asserts.assertEquals(SubClassMock1.class.getField("flag").getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getField("flag").getType(), boolean.class);
		try {
			SubClassMock1.class.getField("blablabla");
			Asserts.fail();
		} catch (NoSuchFieldException ex) {
		}
		try {
			SubClassMock1.class.getField("parent");
			Asserts.fail();
		} catch (NoSuchFieldException ex) {
			
		}
	}

	public String getName() {
		return "getField(String)";
	}

}
